package fc.sj.study.Model;

import fc.sj.study.Bean.UserBean;
import fc.sj.study.biz.UserBiz;
import fc.sj.study.biz.UserLoginListener;

import static android.R.attr.password;

/**
 * Created by Fengchao on 2017/5/6.
 */

public class IUser implements UserBiz{
    @Override
    public void Login(final String username, final String psd, final UserLoginListener userLoginListener) {
        //模拟子线程耗时操作
        new Thread()
        {
            @Override
            public void run()
            {
                try
                {
                    Thread.sleep(2000);
                } catch (InterruptedException e)
                {
                    e.printStackTrace();
                }
                //模拟登录成功
                if ("zhy".equals(username) && "123".equals(password))
                {
                    UserBean user = new UserBean();
                    user.setUsername(username);
                    user.setPassword(psd);
                    userLoginListener.LoginSuccess(user);
                } else
                {
                    userLoginListener.LoginFaild();
                }
            }
        }.start();
    }
}
